<?php
include_once('class/autoload.php');
include_once 'class/MyPDO.php';
$site = new page_base('inscription');
$site->titre = "inscription USEP";
$site->corps = "
    			        <h1>Inscription</h1>
 				<form method='post'>
				<legend> Inscription </legend>
				
					<p> Nom de l'ecole     :<input type='text' name='nome' required/></p>
					<p> Adresse            :<input type='text' name='adresse' required/></p>
					<p> Code Postal        :<input type='number' name='CP' maxlength='5' required/></p>
					<p> Ville              :<input type='text' name='ville' required/></p>
					<p> Telephone          :<input type='number' name='tel' maxlength='10' required/></p>
					<p> Mail               :<input type='text' name='mail' required/></p>
					<p><input name='inscription' type='submit' value='Valider'></p>	
				</form>
		";
//if (isset($_POST['inscription']))
//{

   	if(isset($_POST) && isset($_POST['nome']) && isset($_POST['adresse'])
 && isset($_POST['CP']) && isset($_POST['tel']) && isset($_POST['mail'])){
		$nome = $_POST['nome'];
		$adresse = $_POST['adresse'];
		$CP = $_POST['CP'];
		$ville = $_POST['ville'];
		$tel = $_POST['tel'];
		$mail = $_POST['mail'];
		$i = $bdd->prepare("
			INSERT INTO ecole (nome,adresse,CP,ville,tel,mail)
			VALUES (:nome,:adresse,:CP,:ville,:tel,:mail)");
		$i->execute(array(
				'nome' => $nome ,
				'adresse' =>  $adresse ,
				'CP' =>  $CP ,
				'ville' => $ville ,
				'tel' => $tel ,
				'mail' =>  $mail ,
		));
		
		echo 'insertion reussi';
    	}
    else 
    {
    	echo 'Non reussi';
    }
			

$site->affiche();


?>